package com.woniuxy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.Parking;
import com.woniuxy.mapper.ParkingMapper;
import com.woniuxy.service.ParkingService;
import com.woniuxy.util.PageData;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@AllArgsConstructor
public class ParkingServiceImpl implements ParkingService {
    private ParkingMapper parkingMapper;

    @Override
    public PageInfo<Parking> queryParking(PageData<Parking> pageData) {
        //开始分页
        PageHelper.startPage(pageData.getPageNum(),pageData.getPageSize());
        List<Parking> parkings = parkingMapper.queryParking(pageData.getParam());
        PageInfo pageInfo = new PageInfo(parkings);
        return pageInfo;
    }

    @Override
    public void saveAddParking(Parking parking) {
        parkingMapper.saveAddParking(parking);
    }

    @Override
    public Parking updataParkingBtn(Integer id) {
        return parkingMapper.updataParkingBtn(id);
    }

    @Override
    public void saveUpdateParking(Parking parking) {
        parkingMapper.saveUpdateParking(parking);
    }

    @Override
    public void batchDelParking(List<Integer> ids) {
        parkingMapper.batchDelParking(ids);
    }

    @Override
    public void delParkingBtn(Integer id) {
        parkingMapper.delParkingBtn(id);
    }


}
